
package com.scs.application.modules.cert.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.scs.application.core.service.IBaseService;
import com.scs.application.modules.cert.dto.NoticeUpgradeCertDTO;
import com.scs.application.modules.cert.dto.NoticeUploadCertDTO;
import com.scs.application.modules.cert.entity.CertificateRepository;
import com.scs.application.modules.cert.request.CertificateRepositoryQueryRequest;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 供应商资质仓库 service 接口
 *
 */
public interface CertificateRepositoryService extends IBaseService<CertificateRepository> {


    List<CertificateRepository> list(CertificateRepositoryQueryRequest request);


    IPage<CertificateRepository> page(CertificateRepositoryQueryRequest request);

    /**
     * 供应商资质列表页
     *
     * @param request
     * @return
     */
    IPage<CertificateRepository> pageForSupplier(CertificateRepositoryQueryRequest request);


    /**
     * 供应商效期预警列表页
     *
     * @param request
     * @return
     */
    IPage<CertificateRepository> pageForSupplierWarning(CertificateRepositoryQueryRequest request);

    /**
     * 供应商效期预警列表页
     *
     * @param request
     * @return
     */
    IPage<CertificateRepository> pageForHospitalWarning(CertificateRepositoryQueryRequest request);

    List<CertificateRepository> pageForAudit(CertificateRepositoryQueryRequest request);


    /**
     * 添加供应商资质
     *
     * @param entity
     * @return
     */
    boolean saveForSupplier(CertificateRepository entity);

    /**
     * 添加商品资质
     *
     * @param entity
     * @return
     */
    boolean saveForMaterial(CertificateRepository entity);

    /**
     * 添加厂商资质
     *
     * @param entity
     * @return
     */
    boolean saveForManufacturer(CertificateRepository entity);

    /**
     * 添加品类资质
     *
     * @param entity
     * @return
     */
    boolean saveForCatalog(CertificateRepository entity);

    /**
     * 供应商资质关闭
     *
     * @param id
     */
    void close(String id);

    /**
     * 供应商资质升级
     *
     * @param entity
     */
    void upgrade(CertificateRepository entity);

    /**
     * 提醒升级资质文件
     *
     * @param dto
     */
    void noticeUpgrade(NoticeUpgradeCertDTO dto);


    /**
     * 提醒上传资质文件
     *
     * @param dto
     */
    void noticeUpload(NoticeUploadCertDTO dto);

    /**
     * 资质提交，修改状态为已提交
     *
     * @param id
     */
    void certificateSubmit(String id);

    int countForHospital();

    int countForSupplier();

    /**
     * 修正资质信息
     *
     * @param hospitalId
     */
    void correctionCert(String hospitalId);

    @Transactional(rollbackFor = Exception.class)
    void upgradeCert(CertificateRepository entity);

    int countWarn();

    List<CertificateRepository> listWarn();
}
